<?
    include "../../php/common.php";
    $uid = $_POST['uid'] ; 
    $pageN = $_POST['page'];
    $perPage = $_POST['perPage'];
    $pageSt = ( $_POST['page'] - 1 ) * $_POST['perPage'] ;
    $sql = "SELECT c.id AS id,pname,shoptime,num,price,typename,srcImg 
    FROM `carts` AS c JOIN product AS p ON c.pid=p.id 
    JOIN users AS u ON c.uid = u.id 
    JOIN ptype AS pt ON pt.id = p.type 
    WHERE u.id = {$uid} ORDER BY id ASC LIMIT {$pageSt} , {$perPage}";
    $res = mysqli_query($link,$sql);
    $arr = [];
    while( $one = mysqli_fetch_assoc($res) ){
        $arr[] = $one ;
    }
    echo json_encode($arr);
?>